<?php

Raise::load('core.geometry.RaiseCircle');

/**
 * TestCoreRaiseCircle
 * testing unit of 'phpraise/core/RaiseCircle.php'
 *
 * @author Sam-Mauris Yong / hellclanner at live dot com
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.UnitTest.Test
 */
class TestCoreRaiseCircle extends RaiseTest {

    public static function testClass(){
        self::assertClassExists('RaiseCircle');
        self::assertClassExtends('RaiseCircle', 'RaiseShape');

        self::assertClassMethod('RaiseCircle', 'radius');
        self::assertClassMethod('RaiseCircle', 'diameter');
        self::assertClassMethod('RaiseCircle', 'circumference');
        self::assertClassMethod('RaiseCircle', 'area');
        self::assertClassMethod('RaiseCircle', 'location');
    }

    public static function testCircle1(){
        $circle = new RaiseCircle(5);

        self::assertObjectClass($circle, 'RaiseCircle');
        self::assertStrictEqual($circle->radius(), 5);

        self::assertStrictEqual($circle->diameter(), 10);
        self::assertStrictEqual($circle->area(), pi() * 5 * 5);
        self::assertStrictEqual($circle->circumference(), pi() * 10);
        self::assertTrue($circle->location()->equals(RaisePoint::zero()));
    }

    public static function testCircle2(){
        $circle = new RaiseCircle(20);

        self::assertObjectClass($circle, 'RaiseCircle');
        self::assertStrictEqual($circle->radius(), 20);

        self::assertStrictEqual($circle->diameter(), 40);
        self::assertStrictEqual($circle->area(), pi() * 20 * 20);
        self::assertStrictEqual($circle->circumference(), pi() * 40);

        $circle->location(new RaisePoint(5, 5));

        self::assertTrue($circle->location()->equals(new RaisePoint(5, 5)));
    }

}
